package com.gdawj.javabeans;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.validation.constraints.Size;

@Entity
@NamedQueries({
	@NamedQuery(name="listeAides",query="SELECT a FROM Aide a"),
        @NamedQuery(name="listeTotalAides",query="SELECT COUNT(a) FROM Aide a"),
	@NamedQuery(name="aideAvecParam",query="SELECT a FROM Aide a WHERE a.page LIKE :fpage")
})
public class Aide implements Serializable {

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private int idAide;
    @Size(min=3,message="Le nom de la page doit avoir au moins 3 caractères")
    private String page;
    @Lob
    private String contenu;

    public Aide() {
    }

    public Aide(int idAide, String page, String contenu) {
        this.idAide = idAide;
        this.page = page;
        this.contenu = contenu;
    }

    public String getContenu() {
        return contenu;
    }

    public void setContenu(String contenu) {
        this.contenu = contenu;
    }

    public int getIdAide() {
        return idAide;
    }

    public void setIdAide(int idAide) {
        this.idAide = idAide;
    }

    public String getPage() {
        return page;
    }

    public void setPage(String page) {
        this.page = page;
    }

}


